#ifndef _ICMPSOCKET_H_
#define _ICMPSOCKET_H_

#include "net/Socket.hpp"
#include "net/SocketImpl.hpp"
#include "net/IPAddress.hpp"
#include "net/SocketAddress.hpp"

NET_NAMESPACE_BEGIN

/*
* ICMP client
*/
class CICMPSocket : public CSocket
{
public:
	CICMPSocket(CIPAddress::Family family, int dataSize = 48, int ttl = 128, int timeout = 500000);
	CICMPSocket(const CSocket& socket);
	~CICMPSocket();
	CICMPSocket& operator = (const CSocket& socket);

	int sendTo(const CSocketAddress& address, int flags = 0);
	int receiveFrom(CSocketAddress& address, int flags = 0);

	int dataSize() const;
	int ttl() const;//Time-To-Live value
	int timeout() const;

protected:
	CICMPSocket(CSocketImpl* pImpl);

private:
	int m_dataSize; 
	int m_ttl;
	int m_timeout;
};

NET_NAMESPACE_END

#endif
